{% extends 'layout/basic.html' %}
{%  load static %}
{% block css %}
<link rel="stylesheet" href="{% static 'css/login.css' %}">
{%  endblock %}
{% block content %}

<div class="container a">
    <form action="" method="post" novalidate>  
        {% csrf_token %}  
    <h3>{{title}}</h3>
    {% for item in form %}
    {% if item.name == 'code' %}
    <div class="mb-3 clearfix b">
        <label  class="form-label "><b>{{item.label}}</b></label>
        <div class="row">
        <div class="col-md-6">{{ item }}</div>
        <div class="col-md-6"><img src="/login/img/" id="imgcode" title="点击更换图片" ></div>
        <span style="color: red;"> {{item.errors.0}}</span>
        </div>
    </div>
    {% else %}
    <div class="mb-3 b">
        <label  class="form-label"><b>{{item.label}}</b></label>
        {{ item }}
        <span style="color: red;"> {{item.errors.0}}</span>
    </div>
    {% endif %}
{% endfor %}
<button type="submit " class="btn btn-primary b " style="float: left;" >登录</button>
<div><a href="#" class="b"  style="text-decoration: none;float: right;">短信登陆</a></div>
</form>
</div>
{% endblock %}

{%  block js %}
   <script>
    $('#imgcode').click(function(){
        var  old=$(this).attr('src');
        $(this).attr('src',old+'?')
    })
   </script>
{% endblock %}